//该文件专门为count生成action对象
import { INCREMENT, DECREMENT } from './constant'
//import store from './store'
export const incrementAction = data => ({ type: INCREMENT, data })  //加法
export const decrementAction = data => ({ type: DECREMENT, data })  //减法

//异步加 异步action的值为函数   异步action一般都会调用同步action
export const incrementActionAsync = (data, time) => {
  return (dispatch) => {
    //如果这一步无法执行 需要下载支持的中间件 redux-thunk
    setTimeout(() => {
      dispatch(incrementAction(data))
    }, time)
  }
}